<include file="Public/common" />
<block>

    <style>
        .col-xs-3{margin-top:5px;}
        th{text-align: center;}
    </style>
</block>
<block name="content">

    <div class="container">
        <form>
            <div class="form-group">
               <h3>结算金额:600 (币种:人民币)</h3>
            </div>
            <div class="form-group">
                <label for="exchange_rate"><b>汇率:</b></label>
                <input  onkeyup="clearNoNum(this)" onafterpaste="clearNoNum(this)" type="text" class="form-control" value=""  name="exchange_rate" id="exchange_rate" placeholder="请输入汇率" required>
            </div>
            <div class="form-group">
                <label for="actually_money"><b>实付人民币:</b></label>
                <input  onkeyup="clearNoNum(this)" onafterpaste="clearNoNum(this)" type="text" class="form-control" id="actually_money" value="" name="actually_money" placeholder="实付人民币" required>
            </div>
            <button type="button" class="btn btn-primary" onclick="closingStatus({:I('id')})">确认结算</button>
        </form>
    </div>



</block>
<block name="js">

    <script>
        /**
         * 结算
         * @param id 单项的成本ID
         * @returns {boolean}
         */
        function  closingStatus(id) {
            var exchange_rate=$.trim($('input[name="exchange_rate"]').val());
            var actually_money=$.trim($('input[name="actually_money"]').val());
            if(!exchange_rate){
                layer.msg('请输入汇率!');
                return false;
            }
            if(!actually_money){
                layer.msg('请输入实付人民币!');
                return false;
            }

            $.ajax({
                type: 'POST',
                data: {id:id,exchange_rate:exchange_rate,actually_money:actually_money},
                url: '/index.php?m=Operator&c=Finance&a=closingStatus',
                dataType: 'json',
                success: function (data) {
                    layer.msg(data.msg);
                    if(data.status==1){
                        setTimeout(function(){
                            parent.layer.closeAll();
                        },1500);
                    }
                }
            });

        }
    </script>


</block>
